package com.github.shiqiyue.app.common.result;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/***
 * 基础分页 result
 * @author wenyao.wu
 * @date 2019/7/16
 */
@ApiModel
@Data
public class BasePageResult {

    /***
     * 总共几条数据
     */
    @ApiModelProperty("总共几条数据")
    private Long total;

    /***
     * 分页大小
     */
    @ApiModelProperty("每页几条数据")
    private Long size;

    /***
     * 当前第几页
     */
    @ApiModelProperty("当前第几页")
    private Long current;

    public void setPageInfo(IPage pageInfo) {
        setTotal(pageInfo.getTotal());
        setCurrent(pageInfo.getCurrent());
        setSize(pageInfo.getSize());
    }
}
